#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

typedef int KeyType;
typedef struct
{
	KeyType key;
}ElmeType;

typedef struct
{
	ElmeType* elme;
	int length;
}SSTable;

int SqSearch(SSTable ST, KeyType k)
{
	int i;
	ST.elme[0].key = k;
	for (i = ST.length; ST.elme[i].key != k; i--)
		;
	return i;
}

int BinarySearch(SSTable ST, Keytype k)
{
	int low = 1, high = ST.length, mid;
	while (low <= high)
	{
		mid = (low + high) / 2;
		if (ST.elme[mid].key == k)
			return mid;
		else if (ST.elme[mid] > k)
			high = mid - 1;
		else
			low = mid + 1;
	}
	return 0;
}

